<x-layout>
    <header class="article-header">
        <!-- 标题 -->
        <h1 class="article-title">
            <a>{{$info->title}}</a>
        </h1>

        <div class="article-meta"> 
            <!-- 时间 -->
            <span class="item article-meta-time">
                <time class="time" data-toggle="tooltip" data-placement="bottom" title="时间：{{$info->created_at}}">
                    <i class="glyphicon glyphicon-time"></i> {{$info->created_at}}
                </time>
            </span>
            
            <!-- 分类 -->
            @if($info->typeid)
            <span class="item article-meta-category" data-toggle="tooltip" data-placement="bottom" title="栏目：{{$info->type->name}}">
                <i class="glyphicon glyphicon-list"></i> 
                <a href="program" title="">{{$info->type->name}}</a>
            </span>
            @endif
            
            <!-- 访问量 -->
            <span class="item article-meta-views" data-toggle="tooltip" data-placement="bottom" title="总共有{{$info->visit ? $info->visit : 0}}人访问">
                <i class="glyphicon glyphicon-eye-open"></i> 共{{$info->visit ? $info->visit : 0}}人访问
            </span> 
            
            <!-- 评论数 -->
            <span class="item article-meta-comment" data-toggle="tooltip" data-placement="bottom" title="{{$info->comment}}条评论">
                <i class="glyphicon glyphicon-comment"></i> {{$info->comment}}条评论
            </span> 
        </div>
    </header>


    <article class="article-content">
        <p>
            @if($info->thumb && is_file($info->thumb))
                <img data-original="{{URL::asset($info->thumb)}}" src="{{URL::asset($info->thumb)}}" />
            @else
                <img data-original="{{URL::asset('assets/images/banner/banner_03.jpg')}}" src="{{URL::asset('assets/images/banner/banner_03.jpg')}}" />
            @endif
        </p>

        <p>{{$info->content}}</p>

        <p class="article-copyright hidden-xs">
            未经允许不得转载：
            <a href="{{url('/')}}">首页</a> » 
            <a>{{$info->title}}</a>
        </p>
    </article>

    @if($info->typeid)
        <div class="article-tags">
            分类：<a href="{{url('/', ['typeid' => $info->typeid])}}" rel="tag">{{$info->type->name}}</a>
        </div>
    @endif

    <!-- 相关推荐 -->
    @if($artlist)
        <div class="relates">
            <div class="title">
                <h3>相关推荐</h3>
            </div>
            <ul>
                @foreach($artlist as $item)
                <li><a href="{{url('/info', ['artid' => $item->id])}}">{{$item->title}} ({{$item->comment ? $item->comment : 0}})</a></li>
                @endforeach
            </ul>
        </div>
    @endif

    <div class="title" id="comment">
        <h3>评论 <small>抢沙发</small></h3>
    </div>

    <!-- 评论结构 -->
    <div id="respond">
        <form action="{{url('/comment', ['artid' => $artid])}}" method="post" id="comment-form">
            @csrf
            <div class="comment">
                <div class="comment-title">
                    <img class="avatar" src="{{URL::asset('assets/images/icon/icon.png')}}" alt="" />
                </div>

                <div class="comment-box">
                    <textarea required placeholder="您的评论可以一针见血" name="content" id="comment-textarea" cols="100%" rows="3" tabindex="1"></textarea>

                    <div class="comment-ctrl">
                        <div class="comment-prompt"> 
                            <i class="fa fa-spin fa-circle-o-notch"></i>
                            <span class="comment-prompt-text"></span> 
                        </div>

                        <button type="submit" name="comment-submit" id="comment-submit" tabindex="5">
                            评论
                        </button>
                    </div>
                </div>
            </div>
        </form>
    </div>

    <!-- 评论列表 -->
    @if($comment)
    <div id="postcomments">
        <!-- 评论列表 -->
        <ol class="commentlist">
            @foreach($comment as $key=>$item)
            <li class="comment-content">
                <span class="comment-f">#{{$key + 1}}</span>
                <div class="comment-avatar">
                    <img class="avatar" src="{{URL::asset('assets/images/icon/icon.png')}}" alt="" />
                </div>
                <div class="comment-main">
                    <p>
                        来自<span class="address">{{$item->address ? $item->address : '未知地区'}}</span>的用户
                        <span class="time">({{$item->created_at}})</span><br />{{$item->content}}
                    </p>
                </div>
            </li>
            @endforeach
        </ol>
        
        <!-- 评论分页 -->
        <div class="quotes">
            {{ $comment->onEachSide(1)->links() }}
        </div>
    </div>
    @endif
</x-layout>